R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

photo.data <- officials %>%
  mutate(ifelse(is.na(photoUrl) == FALSE, paste0("![image](", photoUrl, ")"), "Not available"))


officials$photoUrl <- photo.data[, 7]


num.to.rep <- unlist(lapply(parsed.data$offices$officialIndices, length))
expanded <- offices[rep(row.names(offices), num.to.rep), ]
officials <- officials %>% mutate(index = row_number() -1)
expanded <- expanded %>% mutate(index = row_number() -1) %>%
  rename(position = name) 
joined <- left_join(officials, expanded)
## Joining, by = "index"
joined <- select(joined, name, position, party, emails, phones, photoUrl)

gender.plot <- barplot(gender.data, horiz = TRUE)

party.plot <- barplot(party.data, horiz = TRUE)

kable(joined)
name position party emails phones photoUrl
Donald J. Trump President of the United States Republican NULL (202) 456-1111 image
Mike Pence Vice-President of the United States Republican NULL (202) 456-1111 image
Dianne Feinstein United States Senate Democratic NULL (202) 224-3841 image
Kamala D. Harris United States Senate Democratic NULL (202) 224-3553 image
Edmund G. Brown Jr. Governor Democratic NULL (916) 445-2841 Not available
Gavin Newsom Lieutenant Governor Democratic gavin@gavinnewsom.com (916) 445-8994 image
Jim McDonnell Sheriff Nonpartisan info@lasd.org (323) 267-4848 Not available
Jeffrey Prang Assessor Nonpartisan helpdesk@assessor.lacounty.gov (213) 974-3211 Not available
Jackie Lacey District Attorney Nonpartisan webmail@da.lacounty.gov (213) 974-3512 Not available
Kim L. Nguyen Los Angeles County Superior Court Judge Nonpartisan NULL (323) 307-8001 Not available
Efrain Matthew Aceves Los Angeles County Superior Court Judge Nonpartisan NULL (213) 745-1867 Not available
Susan Jung Townsend Los Angeles County Superior Court Judge Nonpartisan NULL (909) 802-1113 Not available
Debra R. Archuleta Los Angeles County Superior Court Judge Nonpartisan NULL (213) 745-1863 Not available
John Chiang State Treasurer Democratic NULL (916) 653-2995 Not available
Xavier Becerra Attorney General Democratic NULL (916) 445-9555 Not available
Betty T. Yee State Controller Democratic NULL (916) 445-2636 Not available
Alex Padilla Secretary of State Democratic secretary.padilla@sos.ca.gov (916) 653-7244 Not available
Dave Jones Insurance Commissioner Democratic NULL (916) 492-3500 Not available
Tom Torlakson State Superintendent of Public Instruction Nonpartisan superintendent@cde.ca.gov (916) 319-0800 Not available
Eric Garcetti Mayor NA mayor.garcetti@lacity.org (213) 978-0600 image
Ron Galperin Controller NA controller.galperin@lacity.org (213) 978-7200 Not available
Mike Feuer City Attorney NA mediate@lacity.org (213) 485-8324 Not available